#ifndef  __UNITRESOURCE_H_
#define  __UNITRESOURCE_H_

#include "common.h"
#include "ini_file_reader.h"
#include "logger.h"
#include "hash.h"
#include "descriptorManager.h"
#include "termlist.h"


//struture:
//---head---|

typedef struct _unit_head_t {
  uint32_t  tlen;
  uint32_t  rsc_num;
  uint32_t* off;
  uint32_t* len;
} unit_head_t;

class UnitResource {
public:
  UnitResource() {};
  ~UnitResource() {};
  int load(int rsc_num, char* output_path);
  void append_unit(char* s, int i);
  void serialize(uint32_t id);
  void reset();

  void chg_file(int fid);

private:
  int m_rsc_num;
  unit_head_t m_head;
  char* m_item[MAX_RSC_NUM];

  FILE*         ofp;
  char		m_output_path[NAME_LEN];
};


#endif
